Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Nonparametric PDA and gate out non valid measurements #636

Merged
merged 3 commits into from
Aug 31, 2022

Conversation

sdhiscocks
Copy link
Member

This adds the ability to use nonparametric PDA for clutter spatial density, where it is estimated based on assumption that measurements within a defined validation region represent the clutter level.

This change also gates out non valid measurements by default, similar to the behaviour in the DistanceHypothesier, and per description in original PDA paper.

@sdhiscocks sdhiscocks added the breaking A breaking change that required other to modify their code label May 12, 2022
@sdhiscocks sdhiscocks requested a review from a team as a code owner May 12, 2022 10:19
@sdhiscocks sdhiscocks requested review from jswright-dstl and bgarthwaite-dstl and removed request for a team May 12, 2022 10:19
@codecov
Copy link

codecov bot commented May 12, 2022

Codecov Report

Merging #636 (323f87a) into main (ee4ad3a) will increase coverage by 0.02%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #636      +/-   ##
==========================================
+ Coverage   94.48%   94.50%   +0.02%     
==========================================
  Files         171      171              
  Lines        8789     8822      +33     
  Branches     1705     1711       +6     
==========================================
+ Hits         8304     8337      +33     
  Misses        350      350              
  Partials      135      135              
Flag Coverage Δ
integration 69.44% <72.97%> (+0.04%) ⬆️
unittests 90.80% <100.00%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
stonesoup/hypothesiser/probability.py 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@sdhiscocks sdhiscocks force-pushed the nonparametric_pda branch from fe653d5 to a372be8 Compare May 12, 2022 10:38
@sdhiscocks sdhiscocks requested review from jmbarr and removed request for bgarthwaite-dstl May 12, 2022 10:58
@sglvladi sglvladi self-requested a review August 23, 2022 13:16
@@ -118,6 +137,7 @@ def hypothesise(self, track, detections, timestamp, **kwargs):

# True detection hypotheses
for detection in detections:
valid_measurement = False
Copy link
Collaborator

@sglvladi sglvladi Aug 23, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe move this above line 154 with a comment about gating?


@staticmethod
@lru_cache()
def _inv_cov(meas_pred):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not too keen on single-line functions, but I'm guessing this is done to take advantage of caching?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. However, there are other modifications with Mahalanobis measure that include built in caching. I may rebase of main and then can take advantage of that and remove the need for this function.

Comment on lines 160 to 166
if self.clutter_spatial_density is None:
# Note: will divide by validated measurements count later...
probability *= self._validation_region_volume(
self.prob_gate, measurement_prediction)
else:
probability /= self.clutter_spatial_density
Copy link
Collaborator

@sglvladi sglvladi Aug 23, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if self.clutter_spatial_density is None:
# Note: will divide by validated measurements count later...
probability *= self._validation_region_volume(
self.prob_gate, measurement_prediction)
else:
probability /= self.clutter_spatial_density
# Parametric PDA
if self.clutter_spatial_density is not None:
probability /= self.clutter_spatial_density

Might be more readable if the calculation for the case self.clutter_spatial_density is None is all done in one place on lines 175-177, given that we are iterating over the hypotheses and making the check anyway. The comment is helpful, but I think keeping the "equations" together is more helpful.

@sglvladi
Copy link
Collaborator

Looks good overall 👍 Added some minor notes on making the code more readable.

Note on earlier discussion: I don't think we can avoid gating when doing the non-parametric version. We could avoid it for the parametric one, but then it would be confusing to say we do gating in one case but not the other.

sdhiscocks and others added 3 commits August 24, 2022 09:10
This adds the ability to use nonparametric PDA for clutter spatial
density, where it is estimated based on assumption that measurements
within a defined validation region represent the clutter level.

This change also gates out non valid measurements by default, similar to
the behaviour in the DistanceHypothesier, and per description in
original PDA paper.
@sdhiscocks sdhiscocks merged commit f828abc into main Aug 31, 2022
@sdhiscocks sdhiscocks deleted the nonparametric_pda branch August 31, 2022 07:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking A breaking change that required other to modify their code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants